# added by yinchao, Mon June 24 09:44	2024
# regular expressions
# a simulation of grep

import re

re_str = input("Enter a regular expressions: ")

fhand = open('mbox.txt', 'r')

count = 0
for line in fhand:
    if re.search(re_str, line):
        count += 1

print(f'mbox.txt had {count} lines that matched {re_str}')
